package com.myPlaneGame.obj;

import java.awt.*;

public class ExplodeObj extends GameObj{
    //静态图片数组(存放爆炸的一系列图片)
    static Image[] explodePic=new Image[16];
    //定义变量来记录爆炸图的下标
    int explodeIndex =0;
    //定义一个静态代码块来将爆炸图片放到数组中
    static {
        for (int i = 0; i < explodePic.length; i++) {
            explodePic[i]=Toolkit.getDefaultToolkit().getImage("imgs/explode/e"+(i+1)+".gif");
        }
    }

    @Override
    public void paintSelf(Graphics g) {
        if(explodeIndex <16){
            //爆炸图片没有播放完毕
            super.img=explodePic[explodeIndex];
            super.paintSelf(g);
            explodeIndex++;
        }
    }

    public ExplodeObj(int x, int y) {
        super(x, y);
    }
}
